package edu.hunau.cxb.controller;

import edu.hunau.cxb.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author hb
 * @create 2020-03-25 11:17
 */
@RequestMapping("/user")
@Controller
public class UserManagerController {

    @RequestMapping(value="/login",method = RequestMethod.POST)
    public String login(User user){
        System.out.println(user);
        //System.out.println("这是神马问题");
        return "forward:/WEB-INF/jsp/success.jsp";
    }


    @RequestMapping(value={"/loginview","/loginjsp"},method = RequestMethod.GET)
public ModelAndView loginView(){

    ModelAndView mv = new ModelAndView();
    mv.setViewName("/user/login");
    return mv;
}

    @RequestMapping("/getUser/{id}")
    public String getUser(@PathVariable("id") Integer id){
        System.out.println("id="+id);

        return "success";
    }
}
